ParserInterface.js ➔ ???   A
last analyzed

Complexity

Conditions 4
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
nc 1
dl 0
loc 8
ccs 2
cts 4
cp 0.5
rs 9.2
cc 4
nop 0
crap 6
1
/**
2
 * @ignore module.exports
3
 * @ignore exports
4
 */
5
6
/**
7
 * @interface ParserInterface
8
 * Parser interface
9
 * Declare parse method must be defined in class
10
 */
11
class ParserInterface {
12
  /**
13
   * ParserInterface constructor
14
   * @throws TypeError When create new instance
15
   * @throws Error When parse method does not define
16
   */
17
  constructor () {
18 12
    if (new.target === ParserInterface) {
19
      throw new TypeError('ParserInterface is interface')
20
    }
21 12
    if (typeof this.parse === 'undefined' || typeof this.parse !== 'function') {
22
      throw new Error('Parse method must be defined')
23
    }
24
  }
25
}
26
27
module.exports = ParserInterface